added SSCLI 1.0
[windows-sources.git] / sdk / samples / all in on code / Visual Studio 2008 / VBWinFormDesigner / CustomPropertyTab / UC_CustomPropertyTab.vb
blobb4dae72c2d8202de1037524f4dffd7dcad114447
1 '************************************* Module Header **************************************\
2 ' Module Name: UC_CumstomPropertyTab.vb
3 ' Project: VBWinFormDesigner
4 ' Copyright (c) Microsoft Corporation.
5 '
6 '
7 ' The CustomPropertyTab sample demonstrates how to add custom PropertyTab on to the
8 ' Properties Windows
9 '
11 ' This source is subject to the Microsoft Public License.
12 ' See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
13 ' All other rights reserved.
15 ' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
16 ' EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED
17 ' WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
18 '***************************************************************************'
20 Imports System.ComponentModel
21 Imports System.Windows.Forms.PropertyGridInternal
23 Namespace CustomPropertyTab
25 <PropertyTab(GetType(CustomTab), PropertyTabScope.Component)> _
26 Partial Public Class UC_CustomPropertyTab
27 Inherits UserControl
29 Public Sub New()
30 Me.InitializeComponent()
31 End Sub
33 <CustomTabDisplayAttribute(True), Browsable(False)> _
34 Public Property TestProp() As String
35 Get
36 Return Me._testProp
37 End Get
38 Set(ByVal value As String)
39 Me._testProp = value
40 End Set
41 End Property
43 'Private components As IContainer = Nothing
44 Private _testProp As String
45 End Class
48 Public Class CustomTab
49 Inherits PropertiesTab
51 Public Overrides Function CanExtend(ByVal extendee As Object) As Boolean
52 Dim test As Boolean = TypeOf extendee Is UC_CustomPropertyTab
53 MessageBox.Show(test.ToString())
54 Return TypeOf extendee Is UC_CustomPropertyTab
55 End Function
57 Public Overrides Function GetProperties(ByVal context As ITypeDescriptorContext, ByVal component As Object, ByVal attrs As Attribute()) As PropertyDescriptorCollection
58 Return TypeDescriptor.GetProperties(component, New Attribute() {New BrowsableAttribute(False), New CustomTabDisplayAttribute(True)})
59 End Function
61 Public Overrides ReadOnly Property TabName() As String
62 Get
63 Return "Custom Tab"
64 End Get
65 End Property
66 End Class
69 <AttributeUsage(AttributeTargets.Property)> _
70 Public Class CustomTabDisplayAttribute
71 Inherits Attribute
73 Public Sub New(ByVal display As Boolean)
74 Me.Display = display
75 End Sub
77 Public Property Display() As Boolean
78 Get
79 Return Me._display
80 End Get
81 Set(ByVal value As Boolean)
82 Me._display = value
83 End Set
84 End Property
86 Private _display As Boolean
87 End Class
88 End Namespace